﻿//创建时间: 2010-10-11
//创建作者: 李 城
//功能说明: 录入限制 列表管理
//最后修改: 2010-10-11
using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using TRPOP.Common;
using TRPOP.CMS.Web.UI;


using TRPOP.CMS.Business;
using TRPOP.CMS.Model;

namespace TRPOP.CMS.Web.Admin
{
    public partial class FormInputLimitType_list : BaseAdmin
    {
        #region 当前页面权限验证
        protected override void SubPageInit()
        {
            base.m_SubPagePermission = Plugin.PermissionKeys.PermissionEnum.SystemManage_ContentModel;
        }
        #endregion


        #region 页面变量
        protected string m_strTitle = "录入限制管理";
        FormInputLimitTypeManage m_FormInputLimitTypeManage = new FormInputLimitTypeManage();
        #endregion

        #region 页面事件
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadBase();
            }
        }
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            LinkButton lbtn = (LinkButton)sender;
            int intFormInputLimitTypeId = 0;
            int.TryParse(lbtn.CommandArgument, out intFormInputLimitTypeId);
            SubmitAlertDelete(m_FormInputLimitTypeManage.DeleteInfoById(intFormInputLimitTypeId));
            LoadBase();
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string strMSG = "名称 、Key或 正则内容";
            if (!PageAssist.CheckForm(txtName, ref strMSG) ||
                !PageAssist.CheckForm(txtKeyWord, ref strMSG) ||
                !PageAssist.CheckForm(txtRegStr, ref strMSG) 
                )
            {
                Alert(strMSG);
                return;
            }
            FormInputLimitTypeInfo oFormInputLimitTypeInfo = new FormInputLimitTypeInfo();
            oFormInputLimitTypeInfo.KeyWord = txtKeyWord.TextTrim.RemoveHtml();
            oFormInputLimitTypeInfo.RegStr = txtRegStr.TextTrim.RemoveUnsafeHtml();
            oFormInputLimitTypeInfo.Name = txtName.TextTrim.RemoveHtml();
            SubmitAlert(m_FormInputLimitTypeManage.Save(oFormInputLimitTypeInfo));
            LoadBase();
        }
        #endregion

        #region 页面方法
        public void LoadBase()
        {
            txtRegStr.Text = "";
            txtName.Text = "";
            txtKeyWord.Text = "";
            rptList.DataSource = m_FormInputLimitTypeManage.GetListByCondition(0, "", " FormInputLimitTypeId asc");
            rptList.DataBind();
        }
        #endregion
    }
}
